<?php
//------------------------
// 用户、用户组视图
// sf_admin_user , sf_auth_group , sf_auth_group_access
//-------------------------
namespace app\common\model;

use think\Model;
use think\Db;

class UserGroupView extends Model{

	// 设置sf_auth_group_access为主表
	protected $table = 'sf_auth_group_access';

	//自定义初始化
    protected function initialize()
    {
        parent::initialize();
        //TODO:自定义的初始化,连表
        $this->join('sf_auth_group','sf_auth_group_access.group_id = sf_auth_group.id','LEFT')
        ->field('sf_auth_group.title group_name');
        $this->join('sf_admin_user','sf_auth_group_access.uid = sf_admin_user.id','LEFT')
        ->field('sf_admin_user.username user_name');
    }

}